package com.sc.pattern.readwrite;

/**
 * Created  on 2018/1/7.
 *
 * @author sc
 */
public class ReadWorker extends Thread{
    private final SharedData data;

    public ReadWorker(SharedData data){
        this.data = data;
    }

    @Override
    public void run() {
        try {
        while (true){
            char[] readBuf = data.read();
            System.out.println(Thread.currentThread().getName()+"reads"+String.valueOf(readBuf));
        }
        }catch (Exception e){
            System.out.println(e);
        }
    }
}
